{extend name="platform/base" /} {block name="main"}
<div class="row padder-v">
	<div class="col-sm-5"></div>
	<div class="col-sm-2">
		<div class="input-group">
			<select id="role" class="input-sm form-control input-s-sm inline">
				<option value="0">全部</option>
				<option value="1">推广员</option>
				<option value="2">股东</option>
				<option value="3">代理</option>
			</select>
		</div>
	</div>
	<div class="col-sm-2">
		<div class="input-group">
			<input id="userName" class="input-sm form-control" type="text"
				value="" placeholder="请输入用户名">

		</div>
	</div>

	<div class="col-sm-2">
		<div class="input-group">
			<input id="userTel" class="input-sm form-control" type="text"
				value="" placeholder="请输入手机号">
		</div>
	</div>
	<div class="col-sm-1">
		<div class="input-group">
			<span class="input-group-btn">
				<button class="btn btn-sm btn-default" type="button"
					onclick="LoadingInfo(1)">搜索</button>
			</span>
		</div>
	</div>
</div>
<section class="panel panel-default">
	<div class="table-responsive">
		<table class="table table-striped b-t b-light text-sm">
			<thead>
				<tr>
					<th><label style="margin-left: 5px;"> <input
							type="checkbox"></label></th>
					<th>用户名称</th>
					<th>是否是推广员</th>
					<th>是否是股东</th>
					<th>是否是代理</th>
					<th>总佣金</th>
					<th>可提现佣金</th>
					<th>已提现佣金</th>
					<th>分销佣金</th>
					<th>股东分红</th>
					<th>股东全球分红</th>
					<th>区域代理佣金</th>
				</tr>
			</thead>
			<tbody id="list">
				<tr></tr>
			</tbody>
		</table>
	</div>
	{include file="platform/page" /}
</section>

<!-- 修改用户上级（Modal）结束 -->
{/block} {block name="script"}
<script type="text/javascript">	
	//查询
	$(function(){
	LoadingInfo(1);
});
	function LoadingInfo(pageIndex) {
		var user_name = $("#userName").val();
		var user_phone = $("#userTel").val();
		var role = $("#role").val();
		$.ajax({
			type : "post",
			url : "PLATFORM_MAIN/Commission/userAccountList",
			async : true,
			data : {
				"pageIndex" : pageIndex,
				"user_name":user_name,
				"user_phone":user_phone,
				"role":role
			},
			success : function(data) {
				var html = '';
				$("#total_count_num").text(data["total_count"]);
				$("#page_count_num").text(data["page_count"]);
				$("#page_count").val(data["page_count"]);
				$("#pageNumber a").remove();
				if (data["data"].length > 0) {
					for (var i = 0; i < data["data"].length; i++) {
						
						if(data["data"][i]["is_promoter"] ==1){
							var is_promoter = "<i class='fa fa-check text-success text-active'></i>";						
						}else{
							var is_promoter = "<i class='fa fa-times'></i>";		
						}
						if(data["data"][i]["is_partner"] ==1){
							var is_partner = "<i class='fa fa-check text-success text-active'></i>";						
						}else{
							var is_partner = "<i class='fa fa-times'></i>";		
						}
						if(data["data"][i]["is_region_agent"] ==1){
							var is_region_agent = "<i class='fa fa-check text-success text-active'></i>";						
						}else{
							var is_region_agent = "<i class='fa fa-times'></i>";		
						}
						html += '<tr>';	
						html += '<td><div class="cell"><label ><input name="sub" type="checkbox" value="'+ data["data"][i]["uid"] +'" ></label></div></td>';
						html += '<td>' + data["data"][i]["real_name"] + '</td>';
						
						html += '<td>' + is_promoter + '</td>';
						html += '<td>' + is_partner + '</td>';
						html += '<td>' + is_region_agent + '</td>';
						html += '<td class="color-red">' + parseFloat(data["data"][i]["commission"]).toFixed(2) + '</td>';
						html += '<td class="color-green">' + parseFloat(data["data"][i]["commission_cash"]).toFixed(2) + '</td>';
						html += '<td class="color-blue">' + parseFloat(data["data"][i]["commission_withdraw"]).toFixed(2) + '</td>';
						html += '<td>' + parseFloat(data["data"][i]["commission_promoter"]).toFixed(2) + '</td>';
						html += '<td>' + parseFloat(data["data"][i]["commission_partner"]).toFixed(2) + '</td>';
						html += '<td>' + parseFloat(data["data"][i]["commission_partner_global"]).toFixed(2) + '</td>';
						html += '<td>' + parseFloat(data["data"][i]["commission_region_agent"]).toFixed(2) + '</td>';
					//	html += '<td>' + parseFloat(data["data"][i]["commission_partner_team"]).toFixed(2) + '</td>';
					//	html += '<td>' + parseFloat(data["data"][i]["commission_promoter_team"]).toFixed(2) + '</td>';
					//	html += '<td>' + parseFloat(data["data"][i]["commission_channelagent"]).toFixed(2) + '</td>';						
						html += '</tr>';
					}
				} else {
					html += '<tr align="center"><th colspan="11">暂无符合条件的数据记录</th></tr>';
				}
				
				$("#list").html(html);
					var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
			}
		});
	}
	
	//全选
	function CheckAll(event){
		var checked = event.checked;
		$(".style0list tbody input[type = 'checkbox']").prop("checked",checked);
	}
	

</script>
{/block}
